% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ops.R
\name{or-op}
\alias{or-op}
\alias{\%||\%}
\title{or operator}
\usage{
lhs \%||\% rhs
}
\arguments{
\item{lhs}{An object of any type.}

\item{rhs}{An object of any type.}
}
\description{
Returns the \code{lhs} object unless it is unset, NULL, NA, or has
a \code{length} of 0 in which case the \code{rhs} object is
returned. Useful for specifying default or fallback values for
variables or values.
}
\details{
The or operator checks the \code{lhs} as a whole ---
    \emph{i.e.}, unlike \code{ifelse} it does not replace
    individual elements matching the stated conditions with the
    \code{rhs} object counterparts. This also means that the
    \code{rhs} object does not have to be of the same type as the
    \code{lhs} object.
}
\examples{
c(1, 2, NA, 4) \%||\% c("a", "b", "c", "d")
numeric(0) \%||\% "V-Dem"
unknown_variable \%||\% 42

}
